// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2022 Ivan Baidakou

#pragma once

#include <cstdint>
#include <limits>

namespace rotor_light {

enum class State { off, initializing, initialized, operational, shutting_down };
enum class StateCommand { init, start, shutdown };
// clang-format off
enum class FailPolicy {
    restart        = 0b00000001,
    force_restart  = 0b00000011,
    escalate       = 0b00000100,
    force_escalate = 0b00001100,
    ignore         = 0b00010000,
};
// clang-format on

using MessageTypeId = uint16_t;
using index_t = uint8_t;
using ActorId = ROTOR_LIGHT_ACTOR;
using EventId = uint16_t;

static constexpr auto broadcast = std::numeric_limits<ActorId>::max();

struct MessageType {
  static constexpr auto undef = std::numeric_limits<MessageTypeId>::max();
};

using TimePoint = ROTOR_LIGHT_TIMEPOINT;
using Duration = ROTOR_LIGHT_DURATION;
using NowFunction = TimePoint (*)();
using Callback = void (*)(void *);

} // namespace rotor_light
